/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: jse2302 - While2
 * <p>Powered by webrx On 2023-06-13 14:03:35
 * <p>Created by IntelliJ IDEA
 *
 * @author  webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class While2 {
    public static void main(String[] args) {
        //1-5
        var i = 0;
        while (i < 5) {
            System.out.printf("%03d ", ++i);
        }

        System.out.println();
        i = 10;
        //10-5
        while (i >= 5) {
            System.out.println(i--);
        }

        //计算1+2+3+...+100=?
        int sum = 0;
        int n = 1;
        while (n <= 100) {
            sum += n;
            ++n;
        }
        System.out.println(sum);

    }
}
